program pendulum
use polymorphic_complextaylor
type (pbfield) h
type (taylor) ht,x,px
type (damap) M ,A
type (NORMALFORM) N
integer NO,ND,NP,NDPT
REAL*8 K,DT,OMEGA

NO=4
ND=1
NP=0
NDPT=0
K=1.D0
DT=0.01D0
OMEGA=1.D0

Call INIT(NO,ND,NP,NDPT,.true.)

CALL ALLOC(M)
CALL ALLOC(A)
CALL ALLOC(N)
CALL ALLOC(H)
CALL ALLOC(HT)
CALL ALLOC(X)
CALL ALLOC(PX)


M=1
X=M.V(1)
PX=M.V(2)

HT=PX**2/2.D0+2.D0*(TWOPI*OMEGA)**2*DSIN(X/2.D0)**2
H=-DT*HT

M=TEXP(H,M)
N.AUTO=.TRUE.
N=M
A=N.A
N.DHDJ.V(1)=N.DHDJ.V(1)/DT
N.DHDJ.V(2)=N.DHDJ.V(2)/DT

CALL DAPRINT(N.DHDJ,6)

N.DHDJ=N.DHDJ*A**(-1)  
CALL DAPRINT(N.DHDJ.V(1),6)

CALL KILL(M)
CALL KILL(A)
CALL KILL(N)
CALL KILL(H)
CALL KILL(HT)
CALL KILL(X)
CALL KILL(PX)
end program  pendulum

